﻿@model VedranKrizicPortfolio.Models.Article
@{
    ViewBag.Title = "NewArticle";
}
<script type="text/javascript" src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/ckeditor/adapters/jquery.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div style="overflow: scroll; width: 641px; height: 538px;">
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)
        <fieldset style="clear: left; margin-top: 10px;">
            <legend style="font-weight: bold;">New Article @ViewBag.Error</legend>
            <div class="inputFields">
                <div class="editor-field">
                    <div>
                        @Html.LabelFor(model => model.Title)
                        @Html.ValidationMessageFor(model => model.Title , "*")
                    </div>
                    <div>
                        @Html.TextBoxFor(model => model.Title, new { @placeholder = "Title" })
                    </div>
                </div>
                <div class="editor-field">
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Type)
                        @Html.ValidationMessageFor(model => model.Type, "*")
                    </div>
                    <div>
                        @Html.DropDownListFor(model => model.Type, new SelectList(ViewBag.ArticleTypes, "Type", "Name"))
                    </div>
                </div>
                <div class="editor-field">
                    <div class="editor-label">
                        Publish Date
                        @Html.ValidationMessageFor(model => model.PublishDate, "*")
                    </div>
                    <div>
                        @Html.TextBoxFor(model => model.PublishDate, new { @type = "date", @class = "publishDate"})
                    </div>
                </div>
                <div class="editor-field">
                    <div class="editor-label">
                        Cover Image URL
                        @Html.ValidationMessageFor(model => model.CoverIMG)
                    </div>
                    <div>
                        @Html.TextBoxFor(model => model.CoverIMG, new { @placeholder = "Cover img URL" })
                    </div>
                </div>
            </div>
            <div style="float: left;">
                @Html.TextAreaFor(model => model.Text, new { @class = "adminRichText" })
            </div>
            <p>
                <input type="submit" value="Create" />
                @Html.ActionLink("Back to List", "ArticleList")
            </p>
        </fieldset>
    }

</div>
<script type="text/javascript">
    $(document).ready(function () {
        $(".adminRichText").ckeditor();
        $(".publishDate").datepicker({ dateFormat: 'yy-mm-dd' });
    });
</script>
